<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>店铺-商家列表</title>
<link href="<?php echo $this->_webroot('/style/jq-ui/jquery-ui-1.8.18.custom.css'); ?>" rel="stylesheet" type="text/css">
<link href="<?php echo $this->_webroot('/style/css.css'); ?>" rel="stylesheet" type="text/css">
<link href="<?php echo $this->_webroot('/style/content.css'); ?>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?php echo $this->_webroot('script/jquery-1.7.1.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/jquery-ui-1.8.18.custom.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/jquery.carouFredSel-5.5.0-packed.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/js.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/content.js'); ?>"></script>
</head>
<body>

<psp:tags     htmlname='default_topnav'  iconname='defaulttopnav' />


<div class="head headpadding">
	<div class="logo-box">
    	<a class="logo" href="#"><img src="<?php echo $this->_webroot('images/logo1.gif'); ?>" alt="" /></a>
    </div>
    
    <psp:tags     htmlname='city'  iconname='city' />
    
    <div class="search-box">
        <div class="search_form_wrap">
        	<div class="searchForm1">
            	<form action="<?php echo $this->_url('default/shop/');?>" method="get" id="searchkeyForm" class="searchkeyForm" name="searchkeyForm" >
            	<input type="text" class="searchInput1" name="k"  />
                <input type="submit" class="searchBtn1 search_alertimg" value="搜店铺"  />
                </form>	
            </div>
            <div class="adsearch1">
            	<a href="<?php echo $this->_url('default/shop/');?>">高级搜索</a><br />
                <a href="<?php echo $this->_url('article/index/?id=3');?>">使用帮助</a>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<psp:tags     htmlname='default_navlist'  iconname='default_navlist' />

<div class="container margintop1">	

	<!-- main_left1 -->
	<div id="main_left1">
    
    	<!-- 产品选择条件 -->
        <div class="prot_choose_div">
        	<div class="protchoose_hd">
            	<span><a href="<?php echo $this->_url('default/index/');?>">首页</a>&gt;<a href="<?php echo $this->_url('default/supplier/');?>" class="color1">供货商筛选分类</a><!--&gt;<a href="" class="color1">开关</a>--></span>
                <a href="" class="more3 more5">更多</a>
                <div class="clear"></div>
            </div>
            <div class="protchoose_body">
<style>			
.active {
    background-color: #F77A07;
    color: #FFFFFF;
    padding: 1px 2px;
    margin-right: 7px;	
    text-decoration: none;
    outline: medium none;	
}
</style>		
			<?php  foreach(array_slice ($CATEGORY[0], 0) as $key=>$cat){?>			
            	<div class="protchoose_li">
                	<span class="protchoose_tab">
					<?php if($cat['id']==$cat_id){?> 
					    <a class='active' href="<?php echo $this->_url('default/supplier/');?>?cat_id=<?php echo  $cat['id'];?>&k=<?php echo  $k;?>&page=<?php echo  $page;?>" title="<?php echo  $cat['cat_name'];?>"><?php echo  $cat['cat_name'];?></a>：
				    <?php }else {?> 
				        <a href="<?php echo $this->_url('default/supplier/');?>?cat_id=<?php echo  $cat['id'];?>&k=<?php echo  $k;?>&page=<?php echo  $page;?>" title="<?php echo  $cat['cat_name'];?>" style="color: #000000;font-size: 14px;font-weight: bold"><?php echo  $cat['cat_name'];?></a>：
				    <?php }?>
				     </span>
                    <?php if(isset($CATEGORY[$cat['id']]) && $CATEGORY[$cat['id']]){?>
				        <?php  foreach(array_slice ($CATEGORY[$cat['id']], 0) as $subcat){?>
				            <?php if($subcat['id']==$cat_id){?> 
							    <a class='active' href="<?php echo $this->_url('default/supplier/');?>?cat_id=<?php echo  $subcat['id'];?>&k=<?php echo  $k;?>&page=<?php echo  $page;?>" title="<?php echo  $cat['cat_name'];?>"><?php echo  $subcat['cat_name'];?></a> 
							<?php }else {?> 
								<a href="<?php echo $this->_url('default/supplier/');?>?cat_id=<?php echo  $subcat['id'];?>&k=<?php echo  $k;?>&page=<?php echo  $page;?>" title="<?php echo  $cat['cat_name'];?>" class="colorblack1"><?php echo  $subcat['cat_name'];?></a> 
							<?php }?> 
				        <?php }?>
				    <?php }?>
                </div>				
			<?php }?>				
			
			
<!--			
            	<div class="protchoose_li">
                	<span class="protchoose_tab">主营行业：</span><a href="" class="colorblack1">插排</a><a href="" class="colorblack1">插排</a><a href="" class="colorblack1">插排</a><a href="" class="colorblack1">插排</a><a href="" class="colorblack1">插排</a><a href="" class="colorblack1">插排</a>
                </div>				
				
                <div class="protchoose_li">
                	<span class="protchoose_tab">经营模式：</span>私营<input type="checkbox" name="manage_model" value="" class="checkbox1" />国企<input type="checkbox" name="manage_model" value="" class="checkbox1" />民营<input type="checkbox" name="manage_model" value="" class="checkbox1" />个体<input type="checkbox" name="manage_model" value="" class="checkbox1" />
                </div>
                <div class="protchoose_li">
                	<span class="protchoose_tab">员工数：</span>0-10<input type="checkbox" name="manage_model" value="" class="checkbox1" />11-50<input type="checkbox" name="manage_model" value="" class="checkbox1" />51-100<input type="checkbox" name="manage_model" value="" class="checkbox1" />101-1000<input type="checkbox" name="manage_model" value="" class="checkbox1" />1000以上<input type="checkbox" name="manage_model" value="" class="checkbox1" />
                </div>
                <div class="protchoose_li">
                	<span class="protchoose_tab">年营业额：</span>0-10万<input type="checkbox" name="manage_model" value="" class="checkbox1" />11-50万<input type="checkbox" name="manage_model" value="" class="checkbox1" />51-100万<input type="checkbox" name="manage_model" value="" class="checkbox1" />101-1000万<input type="checkbox" name="manage_model" value="" class="checkbox1" />1000万以上<input type="checkbox" name="manage_model" value="" class="checkbox1" /></div>
                <div class="protchoose_li last1">
                	<span class="protchoose_tab">地区：</span><a href="" class="colorblack">北京</a><a href="" class="colorblack">上海</a><a href="" class="colorblack">深圳</a><a href="" class="colorblack">苏州</a><a href="" class="colorblack">沈阳</a><a href="" class="colorblack">石家庄</a><a href="" class="colorblack">北京</a><a href="" class="colorblack">上海</a><a href="" class="colorblack">深圳</a><a href="" class="colorblack">苏州</a><a href="" class="colorblack">沈阳</a><a href="" class="colorblack">石家庄</a>
                </div>
-->
            </div>
        </div>
        <!-- 产品选择条件 end -->
        
    	<!-- 所有商品 -->
		<div class="allgoods_wrap margintop1">
            <div class="all_goods_hd">
                <ul class="all_goods_hd_ul">
                	<li><a href="" class="popularity allgoods">相关供货商</a></li>
<!--                    <li><a href="" class="popularity">人气</a></li>
                    <li><a href="" class="popularity">价格</a></li>
                    <li><a href="" class="popularity">成交量</a></li>
                    <li><a href="" class="popularity">新品</a></li>
-->					
                </ul>
            </div>
            <div class="all_godds_body">
            	<div class="search_conditon">
                	<img src="<?php echo $this->_webroot('images/condition_left.jpg'); ?>" width="5" height="33" class="condition_left" />
                    <div class="search_condition_center">
                    <form action="<?php echo $this->_url('default/supplier/');?>" method="get" >					
                    	<span>地区：</span>
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js');?>"></script>
<script language="JavaScript">
<!--
function areachanged(value,type){
	if(value > 0) {	
		ajax("<?php echo $this->_url('default/getareas');?>","POST","value="+value+"&mode=shopinfo&pre=shop_&type="+type,function(return_text){
			var return_text = return_text.replace(/[\n\r]/g,"");
			if(return_text==""){
				alert("请重新选择!！");
			} else {
				if(type==0) {
					document.getElementById("user_province").innerHTML = return_text;
					show("user_province");
					hide("user_city");
				} else if(type==1) {
					document.getElementById("user_city").innerHTML = return_text;
					show("user_city");
				}
			}
		});
	} else {
		if(type==1) {
			hide("user_city");
		} else if(type==0) {
			hide("user_city");
			hide("user_province");
		}
	}
}
function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function show(id) {
	document.getElementById(id).style.display = '';
}
//-->
</script>							
<?php 
        $this->controller->loadModel('area');		
		$return_array = $this->controller->area->find('all');
	    $areas_info = array();		
	    foreach($return_array as $k=>$v) {
		    $areas_info[$v['area']['area_type']][$v['area']['id']]['id'] = $v['area']['id'];
		    $areas_info[$v['area']['area_type']][$v['area']['id']]['parent_id'] = $v['area']['parent_id'];
		    $areas_info[$v['area']['area_type']][$v['area']['id']]['area_name'] = $v['area']['area_name'];
		    $areas_info[$v['area']['area_type']][$v['area']['id']]['area_type'] = $v['area']['area_type'];
	    }
?>							
								<span id="user_province">
								<select name="province" onchange="areachanged(this.value,1);">
									<option value='0'>选择省份</option>
								<?php foreach($areas_info[1] as $v) { ?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$province){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php }?>
								</select>
								</span>
								
								<span id="user_city">
								<?php 	 if($province){?>
								<select name="city" onchange="areachanged(this.value,2);">
									<option value='0'>选择城市</option>
								    <?php foreach($areas_info[2] as $v) {
										if($v['parent_id'] == $province){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$city){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?></select>
								<?php }?>
								</span>
                        <span class="price_label">供货商名称：</span>
                        <input type="text" class="inputtext1" name="k" value="<?php echo $keyworld;?>"  style="width:150px;"/>
								
                        <input type="submit" value="" class="submit2 marginleft1" />
						</form>						
                    </div>                    
                    <img src="<?php echo $this->_webroot('images/condition_right.gif'); ?>" width="5" height="33" class="condition_right" />
                	<div class="clear"></div>
                </div>
                <div class="shop_message_list">
                	<div class="shop_message_hd">
                    	<span class="shop_width1">供货商信息</span><span class="shop_width2">认证</span><span class="shop_width3">所在地区</span><span class="shop_width4">加盟时间</span>
                    </div>
                	<div class="shop_message_body">
									

						<?php $i = 0 ;  foreach($result['data'] as $key=>$val){ $i++;?>					
                    	<div class="shop_message_content <?php if ($i%2 ==0) { ?> background_color1<?php } ?>">
                        	<div class="shop_introduce">
                            	<a href="<?php echo $this->_url('default/productlist/?suppid='.$val['supi_user_id']);?>" class="shop_img_a"><img src="<?php echo $val['supi_logo'];?>" alt="<?php echo $val['supi_name'];?>"  width="65px" height="55px" onerror="this.src='<?php echo $this->_webroot('/user/images/nopic.gif'); ?>'"/></a>
                                <a href="<?php echo $this->_url('default/productlist/?suppid='.$val['supi_user_id']);?>" class="shop_introduce_content" style="width: 250px;"><?php echo $val['supi_name'];?></a>
                                 <span style="color: #000000;float: left;margin-top: 5px;width: 250px;">
								 联系人：<?php echo $val['supi_people'];?><br/>
								 电话:<?php echo $val['supi_telphone'];?><br/>
								 地址:<?php echo $val['supi_address'];?>
								 </span>
								<div class="clear"></div>								  								
                            </div>
                            <span class="manage_range"><?php echo $val['rank_name'];?></span>
                            <span class="shop_area"><?php echo  $areainfo[$val['supi_province']];?>.<?php echo  $areainfo[$val['supi_city']];?></span>
                            <span class="people_num"><?php echo substr($val['created'],0,10);?></span>
                            <div class="clear"></div>
                        </div>
						<?php }?>						
						
                        <div class="clear"></div>
                    </div>
                
						<form  method="get" action="<?php echo $this->_url('default/supplier/');?>">
                        <div class="page-box margintop6">
                            <a href="<?php echo $result['page']['prevPage'];?>" class="pre">上一页</a>
                            <span class="on"><?php echo $result['page']['current']['num'];?></span>	
                            <?php foreach($result['page']['plist'] as $k => $v ) { ?>							
                            <a href="<?php echo $v; ?>"><?php echo $k; ?></a>
							<?php } ?>
<!--                            <a href="#">2</a>
                            <span class="more">...</span>
                            <a href="#">9</a>
                            <a href="#">10</a>

                            <a href="#">12</a>
                            <a href="#">13</a>
                            <span class="more">...</span>
                            <a href="#">20</a>
                            <a href="#">21</a>-->
                            <a href="<?php echo $result['page']['nextPage'];?>" class="next">下一页</a>
                            <span>共<?php echo $result['page']['pageCount'];?>页</span>
							
                            <span>到<input type="text" class="go-page" name="page" />页</span>
							<input type="hidden"  name="cat_id" value="<?php echo $cat_id; ?>"/>
						    <input type="hidden"  name="k" value="<?php echo $keyworld; ?>"/>	
						    <input type="hidden"  name="province" value="<?php echo $province; ?>"/>
						    <input type="hidden"  name="city" value="<?php echo $city; ?>"/>							
							<input type="submit" class="go-page-btn" value="跳&nbsp;转" />							
                         </div>
						 </form>  
                </div>    
                
                <div class="clear"></div>
            </div>
        	                    
    	</div>
		<!-- 所有商品 end -->
    </div>
    <!-- main_left1 end -->


	<!-- main_right1 -->
	<div id="main_right1"> 
        <!--  热销商品 -->
        <psp:tags     htmlname='default_shop_hotgoods'  iconname='default_shop_hotgoods' />
        <!--  热销商品 end -->
        
        
        <div class="clear"></div>
        
        
    </div>
    <!-- main_right1 end -->


	<div class="clear"></div>
</div>


<!-- 友情链接 -->

<!-- 友情链接 end -->

<div class="clear"></div>

<psp:tags     htmlname='default_footer'  iconname='defaultfooter' />

            <input type="hidden" value="<?php echo  $this->controller->my->id;?>" id="shop_user" />			
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js');?>"></script>
<script language="JavaScript">
	<!--
		function addCart(id) {
		
			var num = document.getElementById('num'+id);
			var shop_id = document.getElementById('shopid'+id).value;
			var user_id = document.getElementById('shop_user').value;
			
			var num_reg = /^(\d+)$/;
			if(!num_reg.test(num.value)){
				alert('购买数量格式不正确!');
				return;
			}
			if(num.value=='0'){
				alert('购买数量不能为0！');
				return;
			}

			if (shop_id == user_id){
				alert('自己的商品不能放入购物车');
			}else{
				ajax("<?php echo $this->_url('shop/goodsaddcart');?>","POST","id="+id+"&num="+num.value,function(data){
					if(data == 1) {
						alert("已成功添加到您的购物车！");
					} else if(data == -1) {
						alert("此商品已在您的购物车里！");
					} else if(data == -2) {
						alert("库存里没有这么多商品！");
					} else {
						alert("添加失败，请确认您是否已登陆！");
					}
				});
			}
		}
	-->	
</script>	
</body>
</html>